package java_exceptions.what_is_exception;

public class JavaException4 {

	public static void main(String[] args) {
		try {
			divide(10,0);
		} catch (IllegalArgumentException ex) {
			System.out.println(ex.getMessage());
		}
	}

	static int divide(int x, int y) {

		if (y == 0) {
			throw new IllegalArgumentException
					("denominator can not be 0");
		} else {
			return x / y;
		}
	}
}
